import a from 'utils/check.js'
import './css/index.css'
import '@/less/index.less'
import img from './assets/logo.png'
import axios from 'axios'
// console.log(a.checkPassWord('asdasasdasasd'))
document.querySelector('.login-btn').addEventListener('click', () => {
    const username = document.querySelector('.username').value.trim()
    const password = document.querySelector('.password').value.trim()
    console.log(username, password)
    if (!a.checkUserName(username)) {
        return alert('寄')
    }
    if (!a.checkPassWord(password)) {
        return alert('ji')
    }
    axios({
        url: 'http://hmajax.itheima.net/api/register',
        method: 'POST',
        data: {
            username,
            password
        }
    }).then(result => {
        alert(result.data.message)
    }).catch(error => {
        alert(error.response.data.message)
    })
})
document.querySelector('.logo-img').src = img


